# -*- coding: utf-8 -*-
from typing import Dict, List, Tuple

from contract_market.base.engine import EventSystemEngineStructure
from .constant import *
from .rpc.rpc import RPCClient  # TODO


class EventSystemEngine(EventSystemEngineStructure):
    """ 

    It is mainly used to deal with IO problems caused by Request requests.
    Or the task creates asynchrony issues,
    
    """
    _fields: List[Tuple] = [
        (XT_SEND_ORDER_EVENT, RPCClient.send_order),
        (XT_CANCEL_ORDER_EVENT, RPCClient.cancel_order),
        (XT_ACCOUNT_INFO_EVENT, RPCClient.get_account_info),

        (EVENT_DESCRIBE, RPCClient.describe),

        (XTFUTURE_BALANCE_EVENT, RPCClient.get_balance),
        (XTFUTURE_SEND_ORDER_EVENT, RPCClient.send_order),
        (XTFUTURE_CANCEL_ORDER_EVENT, RPCClient.cancel_order),
    ]
